package com.zmn.plat.common.dictionary;

/**
 * 渠道等级
 *
 * @author xiangjunming
 * @since 2019 /08/20 14:56:30
 */
public enum ChannelLevelEnum {

    /**
     * values
     */
    PT(1, "普通渠道"),
    VIP(2, "VIP渠道"),
    ZLHZ(3, "战略合作渠道"),
    ;

    /**
     * 普通渠道
     */
    public static final int CONSTS_PT = 1;
    /**
     * VIP渠道
     */
    public static final int CONSTS_VIP = 2;
    /**
     * 战略合作渠道
     */
    public static final int CONSTS_ZLHZ = 3;

    private Integer code;
    private String name;

    ChannelLevelEnum(Integer code, String name) {
        this.code = code;
        this.name = name;
    }

    public Integer getCode() {
        return code;
    }

    public String getName() {
        return name;
    }

    public static ChannelLevelEnum of(Integer code) {
        if(code == null){
            return null;
        }
        switch (code) {
            case 1:
                return PT;
            case 2:
                return VIP;
            case 3:
                return ZLHZ;
            default:
                return null;
        }
    }

    public static String getName(Integer code) {
        ChannelLevelEnum of = of(code);
        return of == null ? null : of.getName();
    }
}
